package eteam.aps.controller;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.common.helper.JsonPage;
import eteam.aps.model.entity.DataDictionaryCategory;
import eteam.aps.model.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 字典分类控制器接口
 *
 * @author yiyikai
 */
public interface IDataDictionaryCategoryController {
    /**
     * 添加字典分类
     *
     * @param category 封装的待添加数据
     * @return 受影响的行数
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping("/ddc/insert")
    R<Integer> insert(@RequestBody DataDictionaryCategory category) throws Exception, AuthException;

    /**
     * 删除字典分类 ---逻辑删除,修改状态为作废
     *
     * @param fId 字典分类内码
     * @return 受影响的行数
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping("/ddc/delete/{fId}")
    R<Integer> delete(@PathVariable String fId) throws Exception, AuthException;

    /**
     * 修改字典分类
     *
     * @param category 封装的待修改数据
     * @return 受影响的行数
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping(value = "/ddc/update")
    R<Integer> update(@RequestBody DataDictionaryCategory category) throws Exception, AuthException;

    /**
     * 查询 单个 ---用于显示字典分类详情
     *
     * @param fId 字典分类内码
     * @return 字典分类详情
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping(value = "/ddc/selectDetails/{fId}")
    R<DataDictionaryCategoryDetailsVo> selectDetails(@PathVariable String fId) throws Exception, AuthException;

    /**
     * 查询 单个 ---用于显示字典可修改数据
     *
     * @param fId 字典分类内码
     * @return 字典分类可修改信息
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping(value = "/ddc/selectUpdate/{fId}")
    R<DataDictionaryCategoryUpdateVo> selectUpdate(@PathVariable String fId) throws Exception, AuthException;

    /**
     * 查询 所有 模糊 ---筛选条件为fDdcCode,fDdcName
     *
     * @param fDdcCode 字典分类编码
     * @param fDdcName 字典分类名称
     * @param page     第几页 必传
     * @param pageSize 每页条数 必传
     * @return 通用分页结果集（字典分类基础信息）
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping("/ddc/selectAll")
    R<JsonPage<DataDictionaryCategoryBasicsVo>> selectAll(
            @RequestParam(value = "fDdcCode", required = false) String fDdcCode,
            @RequestParam(value = "fDdcName", required = false) String fDdcName,
            @RequestParam("page") Integer page,
            @RequestParam("pageSize") Integer pageSize) throws Exception, AuthException;

    /**
     * 查询 所有 模糊 ---筛选条件为fDdcName;不包括状态为作废的数据
     *
     * @param fDdcName 字典分类名称
     * @param pageSize 每页条数 必传
     * @return 集合;可选择的字典分类
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping("/ddc/selectAllInquire")
    R<List<DataDictionaryCategoryInquireVo>> selectAllInquire(
            @RequestParam(value = "fDdcName", required = false) String fDdcName,
            @RequestParam("pageSize") Integer pageSize) throws Exception, AuthException;

    @PostMapping("/ddc/selectAllUser")
    R<List<UserVo>> selectAllUser(@RequestParam(value = "fullName",required = false) String fullName) throws Exception, AuthException;

}